Vue项目部署
tip
记录 Music App 的部署配置过程
修改Nginx 配置
修改 nginx.conf 文件
配置 music-next app
# Insert 指令
i
# 保存退出
:wq
# 重启nginx服务
cd /usr/local/nginx/sbin
./nginx -s reload
修改项目代码
修改vue.config.js:
publicPath 默认为根路径'/',我们选择配置在'/music-next/'子路径下,进行修改
修改base.js:
在生产环境下请求全路径,而不是根路径
连接远程服务器传输
启动部署
cd vue-music-next
npm install
# 自定义的部署指令
npm run deploy
问题1: bash: npm: command not found?
yum install nodejs npm -y
问题2: Node Sass does not yet support your current environment: Linux 64-bit with false
尝试
sudo npm rebuild node-sass
#or
npm audit fix
问题3: npm run cannot find module 'sass'
npm cache clear --force
npm install sass